﻿using System;


using System.Text;
using IAM.Interface.Model.Interface;
using IAM.Interface.Model.ENUM;

namespace IAM.Interface.Model
{
    /// <summary>
    /// 身份信息管理操作类型
    /// </summary>
    public class IdenManageOperationType : AbstractConvertObject,IConvertXml
    {
        #region 属性
        private OperationType _operationtype = OperationType.Create;
        /// <summary>
        /// 身份信息管理操作类型
        /// </summary>
        public OperationType OperationType
        {
            get
            {
                return _operationtype;
            }
            set
            {
                _operationtype = value;
            }
        }
        #endregion
        #region IConvertXml

        public string XMLBoday
        {
            get
            {
                StringBuilder xml = new StringBuilder();
                xml.Append(" <OperationType> ");
                xml.Append(this.OperationType.ToString());
                return xml.ToString();
            }


        }

        public string XMLFinis
        {
            get
            {
                return "</OperationType>";
            }
        }
        public string XML
        {
            get
            {
                return XMLBoday + XMLFinis;
            }
        }
        #endregion
        #region AbstractConvertObject
        public override object ConvertToObject()
        {
            string _str = this.CurrentXmlNode.InnerText;
            switch (_str.ToLower())
            {
                case "create":
                    this.OperationType = OperationType.Create;
                    break;
                case "enable":
                    this.OperationType = OperationType.Enable;
                    break;
                case "disable":
                    this.OperationType = OperationType.Disable;
                    break;
                case "delete":
                    this.OperationType = OperationType.Delete;
                    break;
                case "update":
                    this.OperationType = OperationType.Update;
                    break;
            }
            return this;
        }
        #endregion
    }
}
